package com.ghpt.controller;
import com.ghpt.pojo.HaiShang;
import com.ghpt.service.HaiShangService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

@RestController
@RequestMapping("/haishang")
public class HaiShangController {
    private final HaiShangService haiShangService;

    public HaiShangController(HaiShangService haiShangService) {
        this.haiShangService = haiShangService;
    }
    @GetMapping("/{id}")
    public HaiShang getHaiShangById(@PathVariable Long id) {
        System.out.println("结果是"+haiShangService.findHaiShangById(id));
        return haiShangService.findHaiShangById(id);
    }
    @PutMapping
    public int updateHaiShang(@RequestBody HaiShang haiShang) {
        return haiShangService.updateById(haiShang);
    }
}
